package com.ruoyi.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan(basePackages = {"com.hxzy.authentication.mapper",
                           "com.hxzy.user.mapper",
                           "com.hxzy.site.mapper",
                           "com.hxzy.system.mapper",
                           "com.hxzy.source.mapper",
                           "com.hxzy.enterprise.mapper",
                           "com.hxzy.order.mapper",
"com.hxzy.fleet.mapper"})
//com.hxzy.fleet.mapper
public class MybatisplusConfig {
    /**
     * 新版
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor mp = new MybatisPlusInterceptor();
        mp.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        mp.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return mp;
    }
}
